package br.com.fixtrader.quoteserver;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class ClientAcceptor implements Runnable {

	private ServerSocket server;
	private QuoteServer quoteServer;
	public ClientAcceptor(QuoteServer quoteServer) {
		try {
			server = new ServerSocket(8001);
			this.quoteServer = quoteServer;
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	@Override
	public void run() {
		while (true) {
			try {
				Socket s = server.accept();
				quoteServer.addClient(s);
				System.out.println("adicionando cliente...");
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}

}
